import request from "@/utils/request";
import apiDomain from "../config"; 

enum API {
  LOGIN_URL = "/user/login",
  REG_URL = "/user/add",
  MODULECOUNT_URL = "/user/module_count",
  PERFECTUPDATE_URL = "/user/add_perfect",
  CLASS_URL = "/user/all_class",
  WXLOGIN_URL = "/user/wxlogin",
  SEARCH_URL = "/user/search",
 
  
}

interface loginParamsType {
  account: string;
  password: string;
}
interface regParamsType {
  account: string;
  name: string;
  phone: string;
  college_class: string; 
  password: string; 
}
interface perfectParamsType{
  is_gps: string;
  address: string;
  sfz: string;
  dormitory_number: string;
  family_member: string;
  membership: string;
  contact_phone: string; 
}

export const reqLogin = (loginParams:loginParamsType) => request.post(apiDomain + API.LOGIN_URL, loginParams);
export const reqReg = (regParams:regParamsType) => request.post(apiDomain + API.REG_URL, regParams);
export const reqMyCount = () => request.post(apiDomain + API.MODULECOUNT_URL, {});
export const reqPerfectUpdate = (perfectParams:perfectParamsType) => request.post(apiDomain + API.PERFECTUPDATE_URL, perfectParams);
export const reqClassList = (student_college_id:number) => request.post(apiDomain + API.CLASS_URL, {student_college_id});
export const reqWxLogin = (openid:string) => request.post(apiDomain + API.WXLOGIN_URL, {openid});

export const reqUserSearch = (search_txt:string) => request.post(apiDomain + API.SEARCH_URL, {search_txt});



